home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13057 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  44 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.inap.net!news1!basmith1
  3. From: basmith@iquest.net (Brian Smith)
  4. Subject: Borland gettextinfo and textcolor (in conio.h)
  5. X-Nntp-Posting-Host: ind-015-238-68.iquest.net
  6. Message-ID: <4jvh92$118_001@basmith1.iquest.net>
  7. Summary: Need help using these two together
  8. Keywords: gettextinfo textcolor
  9. Sender: news@iquest.net (News Admin)
  10. Organization: IDT
  11. X-Newsreader: News Xpress Version 1.0 Beta #4
  12. Date: Thu, 4 Apr 1996 03:50:42 GMT
  13.  
  14. I'm trying to blank out several "cells" (x-y coordinates) on a text screen. My 
  15. approach is:
  16. 1. gettextinfo(&TextInfo); //Use gettextinfo from conio.h to retrieve all the 
  17. current text mode settings and store them into a structure called TextInfo.
  18. 2. OldTextColor = TextInfo.attribute // save the current text color for later 
  19. use, in a variable called OldTextColor (an unsigned char, just like in the 
  20. structure of TextInfo.)
  21. 3. textcolor(TextInfo.normattr) // set text color to background color
  22. 4. putch(219) // everywhere I want blanked out. (219 is the big rectangle 
  23. ASCII character)
  24. 5. textcolor(OldTextColor); // to set the text color back to where it was.
  25.  
  26. The problem is that no matter what I do, step 3 sets the text color to light 
  27. gray, which happens to be represented by the integer 7, the highest integer 
  28. you can use for a background color.
  29.  
  30. I have an idea why this happens, but am not experienced enough to quite figure 
  31. it out; all the elements in the TextInfo structure (as defined by conio.h in 
  32. the gettextinfo function) are unsigned characters, but the parameters 
  33. that's passed to textcolor is an integer. So I think the problem is that 
  34. the color (normattr) is stored in TextInfo as an unsigned char, but I need 
  35. it to be an int before I can pass it as a parameter to textcolor. I've tried 
  36. casting these elements as int (textcolor((int)TextInfo.normattr), but it makes 
  37. no difference.
  38.  
  39. Any help w/b greatly appreciated. 
  40.  
  41. brian smith
  42. (new guy w/ one resolution for '96; LEARN C!!)
  43.  
  44.